package com.example.user.feign;

import com.example.common.Code;
import com.example.common.ResultMessage;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author kangshuai
 */
@FeignClient("service-code")
public interface CodeFeign {

    /**
     * 创建验证码，保存到数据库中， 同时调用邮件服务发送邮件
     *
     * @param code
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/code/create", produces = {"application/json;charset=UTF-8"})
    ResultMessage<Boolean> createCode(@RequestBody Code code) throws Exception;

    /**
     * 验证验证码
     *
     * @param code
     * @param code
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/code/verify", produces = {"application/json;charset=UTF-8"})
    ResultMessage<Boolean> verify(@RequestBody Code code) throws Exception;
}
